import { App } from 'vue';
import { use } from 'echarts/core';
import { CanvasRenderer } from 'echarts/renderers';
import { BarChart, LineChart, PieChart, RadarChart } from 'echarts/charts';
import {
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
} from 'echarts/components';
import Breadcrumb from './breadcrumb/index.vue';
import OrganizationTreeSelector from './organization-tree-selector/index.vue';
import MenuSelector from './menu-selector/index.vue';
import PostSelector from './post-selector/index.vue';
import InterfaceHostSelector from './interface-host-selector/index.vue';
import PersonnelSelector from './personnel-selector/index.vue';
import RoleSelector from './role-selector/index.vue';
import MenuTreeSelector from './menu-tree-selector/index.vue';
import SelectUser from './select-user/index.vue';
import PositionLevelSelector from './position-level-selector/index.vue';
import TableDisplayLevelControl from './table-display-level-control/index.vue';
import ApproveRemarkList from './approve-remark-list/index.vue';
import ApproveRemarkCanvas from './approve-remark-canvas/index.vue';
import SelectUsersBook from './select-users-book/index.vue';
import SelectPersonnelBook from './select-personnel-book/index.vue';
import SelectUserGroup from './select-user-group/index.vue';
import SelectPostBook from './select-post-book/index.vue';
import SelectOrgBook from './select-org-book/index.vue';
import OrganizationKeywordSearchTree from './organization-keyword-search-tree/index.vue';
import IconSvg from './icon-svg/index.vue';
import NoData from './nodata/index.vue';

// Manually introduce ECharts modules to reduce packing size

use([
  CanvasRenderer,
  BarChart,
  LineChart,
  PieChart,
  RadarChart,
  GridComponent,
  TooltipComponent,
  LegendComponent,
  DataZoomComponent,
  GraphicComponent,
]);

export default {
  install(Vue: App) {
    Vue.component('Breadcrumb', Breadcrumb);
    Vue.component('OrganizationTreeSelector', OrganizationTreeSelector);
    Vue.component('PostSelector', PostSelector);
    Vue.component('MenuSelector', MenuSelector);
    Vue.component('PersonnelSelector', PersonnelSelector);
    Vue.component('RoleSelector', RoleSelector);
    Vue.component('MenuTreeSelector', MenuTreeSelector);
    Vue.component('SelectUser', SelectUser);
    Vue.component('PositionLevelSelector', PositionLevelSelector);
    Vue.component('TableDisplayLevelControl', TableDisplayLevelControl);
    Vue.component('ApproveRemarkList', ApproveRemarkList);
    Vue.component('ApproveRemarkCanvas', ApproveRemarkCanvas);
    Vue.component('SelectUsersBook', SelectUsersBook);
    Vue.component('SelectPersonnelBook', SelectPersonnelBook);
    Vue.component('SelectUserGroup', SelectUserGroup);
    Vue.component('SelectPostBook', SelectPostBook);
    Vue.component('SelectOrgBook', SelectOrgBook);
    Vue.component(
      'OrganizationKeywordSearchTree',
      OrganizationKeywordSearchTree
    );
    Vue.component('InterfaceHostSelector', InterfaceHostSelector);
    Vue.component('IconSvg', IconSvg);
    Vue.component('NoData', NoData);
  },
};
